﻿@using XStudio.XCRF.Data.Entities.LabCheck
@using XStudio.XCRF.Resources.Entities.LabCheck
@using XStudio.XCRF.Resources.Entities
@model Guid
@{
    ViewBag.Title = "实验室检查历史记录";
    Layout = "~/Views/Shared/Master.cshtml";
}
@{Html.Telerik().Window().Name("LabCheckHisGridWindow").Title("实验室检查历史记录").HtmlAttributes(new { @class = "ContentLargeWindow" })
    .Buttons(buttons => buttons.Clear())
    .Content(
@<text>
    @(Html.Telerik().Grid<LabCheck>()
    .Name("LabCheckHisViewGrid")
    .DataKeys(keys => keys.Add(lab => lab.ID))
    .Columns(columns =>
    {
        columns.Bound(labcheck => labcheck.ID).Hidden();
        columns.BoundDate(labcheck => labcheck.Time).Title(LabCheckResource.Time);
        columns.BoundDateTime(labcheck => labcheck.LastModifyTime).Title(BaseEntityResource.LastModifyTime);
        columns.Bound(labcheck => labcheck.LastModifier.RealName).Title(BaseEntityResource.LastModifier);
        columns.BoundDateTime(labcheck => labcheck.CreateTime).Title(BaseEntityResource.CreateTime);
        columns.Bound(labcheck => labcheck.Creater.RealName).Title(BaseEntityResource.Creater);
        columns.Command(commands =>
        {
            commands.Custom("Detail").Text("查看详情").Ajax(true);
        }).Title("操作");
    })
    .ClientEvents(events =>
    {
        events.OnCommand("OnLabCheckHisCommand");
    })
    .DataBinding(bind =>
    {
        bind.Ajax()
            .Select<LabCheckController>(c => c._LabCheckHisGridList((Guid)Model));
    })
    )
</text>
    ).Render();
}
<script type="text/javascript">
    function LabCheckDetail(id) {
        var url = "@(Url.Action<LabCheckController>(c => c.LabCheckDetail(Guid.Empty)))";
        url = url.replace("@Guid.Empty", id);
        window.location = url;
    }
    function OnLabCheckHisCommand(e) {
        switch (e.name) {
            case "Detail": LabCheckDetail(e.dataItem.ID); break;
        }
    }
</script>